home *** CD-ROM | disk | FTP | other *** search
/ Hyper Stacks 1994 May / Hyper Stacks (Pacific HiTech)(1994)[Mac].iso / HyperTalk / HyperCard Dev. Toolkit / XCMD.Sources / XCmdGlue.inc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-06-27  |  19.9 KB  |  713 lines  |  [TEXT/KAHL]

  1. /*
  2.     XCmdGlue.inc.c  Definitions for calling all standard 
  3.     HyperCard callback routines from C.  Include "HyperXCmd.h" 
  4.     before your program and this file after it.  Arguments are slightly 
  5.     different from Pascal.  The first argument is always a pointer to
  6.     the parameter block that HyperCard passed to the XCMD or XFCN.
  7.     This file derived from the Pascal interface, which is included as
  8.     comments.
  9.     
  10.       ©Apple Computer, Inc. 1987
  11.     All Rights Reserved.
  12.  
  13.     See CFlash.C for an example of how to include this module in your 
  14.     C program.
  15. */
  16.  
  17.  
  18. /*  Do a simple jump subroutine to a procedure with no arguments.  The 
  19.     address of the procedure is in the argument.   Declared above in 
  20.     HyperXCmd.h.  */
  21. /*    typedef void (*MyProcPtr) ();  */
  22. /*  PROCEDURE DoJsr(addr: ProcPtr); INLINE $205F,$4E90;  */
  23.  
  24. #include <HyperXCmd.h>
  25.  
  26. pascal void SendCardMessage(paramPtr,msg)
  27.     XCmdBlockPtr    paramPtr;    StringPtr    msg;
  28.     /* Send a HyperCard message (a command with arguments) to the current card.
  29.        msg is a pointer to a Pascal format string.  */
  30. {
  31.     paramPtr->inArgs[0] = (long)msg;
  32.     paramPtr->request = xreqSendCardMessage;
  33.     ((MyProcPtr) (paramPtr->entryPoint))();
  34. }
  35. /*    PROCEDURE SendCardMessage(msg: Str255);
  36. BEGIN
  37.   WITH paramPtr^ DO
  38.     BEGIN
  39.       inArgs[1] := ORD(@msg);
  40.       request := xreqSendCardMessage;
  41.       DoJsr(entryPoint);
  42.     END;
  43. END;   */
  44.  
  45.  
  46.  
  47. pascal Handle EvalExpr(paramPtr,expr)
  48.     XCmdBlockPtr    paramPtr;    StringPtr    expr;
  49.     /* Evaluate a HyperCard expression and return the answer.  The answer is
  50.        a handle to a zero-terminated string. */
  51. {
  52.     paramPtr->inArgs[0] = (long)expr;
  53.     paramPtr->request = xreqEvalExpr;
  54.     ((MyProcPtr) (paramPtr->entryPoint))();
  55.     return (Handle)paramPtr->outArgs[0];
  56. }
  57. /*  FUNCTION EvalExpr(expr: Str255): Handle;
  58. BEGIN
  59.   WITH paramPtr^ DO
  60.     BEGIN
  61.       inArgs[1] := ORD(@expr);
  62.       request := xreqEvalExpr;
  63.       DoJsr(entryPoint);
  64.       EvalExpr := Handle(outArgs[1]);
  65.     END;
  66. END;   */
  67.  
  68.  
  69. pascal long StringLength(paramPtr,strPtr)
  70.     XCmdBlockPtr    paramPtr;    StringPtr    strPtr;
  71. /* Count the characters from where strPtr points until the next zero byte. 
  72.    Does not count the zero itself.  strPtr must be a zero-terminated string. */
  73. {
  74.     paramPtr->inArgs[0] = (long)strPtr;
  75.     paramPtr->request = xreqStringLength;
  76.     ((MyProcPtr) (paramPtr->entryPoint))();
  77.     return (long)paramPtr->outArgs[0];
  78. }
  79. /*    FUNCTION StringLength(strPtr: Ptr): LongInt;
  80. BEGIN
  81.   WITH paramPtr^ DO
  82.     BEGIN
  83.       inArgs[1] := ORD(strPtr);
  84.       request := xreqStringLength;
  85.       DoJsr(entryPoint);
  86.       StringLength := outArgs[1];
  87.     END;
  88. END;   */
  89.  
  90.  
  91. pascal Ptr StringMatch(paramPtr,pattern,target)
  92.     XCmdBlockPtr    paramPtr;    StringPtr    pattern;    Ptr    target;
  93. /* Perform case-insensitive match looking for pattern anywhere in
  94.    target, returning a pointer to first character of the first match,
  95.    in target or NIL if no match found.  pattern is a Pascal string,
  96.    and target is a zero-terminated string. */
  97. {
  98.     paramPtr->inArgs[0] = (long)pattern;
  99.     paramPtr->inArgs[1] = (long)target;
  100.     paramPtr->request = xreqStringMatch;
  101.     ((MyProcPtr) (paramPtr->entryPoint))();
  102.     return (Ptr)paramPtr->outArgs[0];
  103. }
  104. /*    FUNCTION StringMatch(pattern: Str255; target: Ptr): Ptr;
  105. BEGIN
  106.   WITH paramPtr^ DO
  107.     BEGIN
  108.       inArgs[1] := ORD(@pattern);
  109.       inArgs[2] := ORD(target);
  110.       request := xreqStringMatch;
  111.       DoJsr(entryPoint);
  112.       StringMatch := Ptr(outArgs[1]);
  113.     END;
  114. END;   */
  115.  
  116.  
  117. pascal void SendHCMessage(paramPtr,msg)
  118.     XCmdBlockPtr    paramPtr;    StringPtr    msg;
  119.     /* Send a HyperCard message (a command with arguments) to HyperCard.
  120.        msg is a pointer to a Pascal format string.  */
  121. {
  122.     paramPtr->inArgs[0] = (long)msg;
  123.     paramPtr->request = xreqSendHCMessage;
  124.     ((MyProcPtr) (paramPtr->entryPoint))();
  125. }
  126. /*    PROCEDURE SendHCMessage(msg: Str255);
  127. BEGIN
  128.   WITH paramPtr^ DO
  129.     BEGIN
  130.       inArgs[1] := ORD(@msg);
  131.       request := xreqSendHCMessage;
  132.       DoJsr(entryPoint);
  133.     END;
  134. END;    */
  135.  
  136.  
  137. pascal void ZeroBytes(paramPtr,dstPtr,longCount)
  138.     XCmdBlockPtr    paramPtr;    Ptr    dstPtr;    long    longCount;
  139. /* Write zeros into memory starting at destPtr and going for longCount 
  140.    number of bytes. */
  141. {
  142.     paramPtr->inArgs[0] = (long)dstPtr;
  143.     paramPtr->inArgs[1] = longCount;
  144.     paramPtr->request = xreqZeroBytes;
  145.     ((MyProcPtr) (paramPtr->entryPoint))();
  146. }
  147. /*    PROCEDURE ZeroBytes(dstPtr: Ptr; longCount: LongInt);
  148. BEGIN
  149.   WITH paramPtr^ DO
  150.     BEGIN
  151.       inArgs[1] := ORD(dstPtr);
  152.       inArgs[2] := longCount;
  153.       request := xreqZeroBytes;
  154.       DoJsr(entryPoint);
  155.     END;
  156. END;   */
  157.  
  158.  
  159. pascal Handle PasToZero(paramPtr,pasStr)
  160.     XCmdBlockPtr    paramPtr;    StringPtr    pasStr;
  161. /* Convert a Pascal string to a zero-terminated string.  Returns a handle
  162.    to a new zero-terminated string.  The caller must dispose the handle.
  163.    You'll need to do this for any result or argument you send from 
  164.    your XCMD to HyperTalk. */
  165. {
  166.     paramPtr->inArgs[0] = (long)pasStr;
  167.     paramPtr->request = xreqPasToZero;
  168.     ((MyProcPtr) (paramPtr->entryPoint))();
  169.     return (Handle)paramPtr->outArgs[0];
  170. }
  171. /*    FUNCTION PasToZero(str: Str255): Handle;
  172. BEGIN
  173.   WITH paramPtr^ DO
  174.     BEGIN
  175.       inArgs[1] := ORD(@str);
  176.       request := xreqPasToZero;
  177.       DoJsr(entryPoint);
  178.       PasToZero := Handle(outArgs[1]);
  179.     END;
  180. END;   */
  181.  
  182.  
  183. pascal void ZeroToPas(paramPtr,zeroStr,pasStr)
  184.     XCmdBlockPtr    paramPtr;    char    *zeroStr;    StringPtr    pasStr;
  185. /* Fill the Pascal string with the contents of the zero-terminated
  186.    string.  You create the Pascal string and pass it in as a VAR 
  187.    parameter.  Useful for converting the arguments of any XCMD to 
  188.    Pascal strings. */
  189. {
  190.     paramPtr->inArgs[0] = (long)zeroStr;
  191.     paramPtr->inArgs[1] = (long)pasStr;
  192.     paramPtr->request = xreqZeroToPas;
  193.     ((MyProcPtr) (paramPtr->entryPoint))();
  194. }
  195. /*  PROCEDURE ZeroToPas(zeroStr: Ptr; VAR pasStr: Str255);
  196. BEGIN
  197.   WITH paramPtr^ DO
  198.     BEGIN
  199.       inArgs[1] := ORD(zeroStr);
  200.       inArgs[2] := ORD(@pasStr);
  201.       request := xreqZeroToPas;
  202.       DoJsr(entryPoint);
  203.     END;
  204. END;  */
  205.  
  206.  
  207. pascal long StrToLong(paramPtr,strPtr)
  208.     XCmdBlockPtr    paramPtr;    Str31 *    strPtr;
  209. /* Convert a string of ASCII decimal digits to an unsigned long integer. */
  210. {
  211.     paramPtr->inArgs[0] = (long)strPtr;
  212.     paramPtr->request = xreqStrToLong;
  213.     ((MyProcPtr) (paramPtr->entryPoint))();
  214.     return (long)paramPtr->outArgs[0];
  215. }
  216. /*    FUNCTION StrToLong(str: Str31): LongInt;
  217. BEGIN
  218.   WITH paramPtr^ DO
  219.     BEGIN
  220.       inArgs[1] := ORD(@str);
  221.       request := xreqStrToLong;
  222.       DoJsr(entryPoint);
  223.       StrToLong := outArgs[1];
  224.     END;
  225. END;   */
  226.  
  227.  
  228. pascal long StrToNum(paramPtr,str)
  229.     XCmdBlockPtr    paramPtr;    Str31 *     str;
  230. /* Convert a string of ASCII decimal digits to a signed long integer.
  231.    Negative sign is allowed. */
  232. {
  233.     paramPtr->inArgs[0] = (long)str;
  234.     paramPtr->request = xreqStrToNum;
  235.     ((MyProcPtr) (paramPtr->entryPoint))();
  236.     return paramPtr->outArgs[0];
  237. }
  238. /*    FUNCTION StrToNum(str: Str31): LongInt;
  239. BEGIN
  240.   WITH paramPtr^ DO
  241.     BEGIN
  242.       inArgs[1] := ORD(@str);
  243.       request := xreqStrToNum;
  244.       DoJsr(entryPoint);
  245.       StrToNum := outArgs[1];
  246.     END;
  247. END;  */
  248.  
  249.  
  250. pascal Boolean StrToBool(paramPtr,str)
  251.     XCmdBlockPtr    paramPtr;    Str31 *     str;
  252. /* Convert the Pascal strings 'true' and 'false' to booleans. */
  253. {
  254.     paramPtr->inArgs[0] = (long)str;
  255.     paramPtr->request = xreqStrToBool;
  256.     ((MyProcPtr) (paramPtr->entryPoint))();
  257.     return (Boolean)paramPtr->outArgs[0];
  258. }
  259. /*    FUNCTION StrToBool(str: Str31): BOOLEAN;
  260. BEGIN
  261.   WITH paramPtr^ DO
  262.     BEGIN
  263.       inArgs[1] := ORD(@str);
  264.       request := xreqStrToBool;
  265.       DoJsr(entryPoint);
  266.       StrToBool := BOOLEAN(outArgs[1]);
  267.     END;
  268. END;   */
  269.  
  270.  
  271. pascal void StrToExt(paramPtr,str,myext)
  272.     XCmdBlockPtr    paramPtr;    Str31 *     str;    extended *    myext;
  273.  /* Convert a string of ASCII decimal digits to an extended long integer.
  274.     Instead of returning a new extended, as Pascal does, it expects you 
  275.     to create myext and pass it in to be filled. */
  276. {
  277.     paramPtr->inArgs[0] = (long)str;
  278.     paramPtr->inArgs[1] = (long)myext;
  279.     paramPtr->request = xreqStrToExt;
  280.     ((MyProcPtr) (paramPtr->entryPoint))();
  281. }
  282. /*    FUNCTION StrToExt(str: Str31): Extended;
  283. VAR x: Extended;
  284. BEGIN
  285.   WITH paramPtr^ DO
  286.     BEGIN
  287.       inArgs[1] := ORD(@str);
  288.       inArgs[2] := ORD(@x);
  289.       request := xreqStrToExt;
  290.       DoJsr(entryPoint);
  291.       StrToExt := x;
  292.     END;
  293. END;   */
  294.  
  295.  
  296. pascal void LongToStr(paramPtr,posNum,mystr)
  297.     XCmdBlockPtr    paramPtr;    long     posNum;    Str31 *    mystr;
  298.  /* Convert an unsigned long integer to a Pascal string.  Instead of 
  299.     returning a new string, as Pascal does, it expects you to 
  300.     create mystr and pass it in to be filled. */
  301. {
  302.     paramPtr->inArgs[0] = (long)posNum;
  303.     paramPtr->inArgs[1] = (long)mystr;
  304.     paramPtr->request = xreqLongToStr;
  305.     ((MyProcPtr) (paramPtr->entryPoint))();
  306. }
  307. /*    FUNCTION LongToStr(posNum: LongInt): Str31;
  308. VAR str: Str31;
  309. BEGIN
  310.   WITH paramPtr^ DO
  311.     BEGIN
  312.       inArgs[1] := posNum;
  313.       inArgs[2] := ORD(@str);
  314.       request := xreqLongToStr;
  315.       DoJsr(entryPoint);
  316.       LongToStr := str;
  317.     END;
  318. END;   */
  319.  
  320.  
  321. pascal void NumToStr(paramPtr,num,mystr)
  322.     XCmdBlockPtr    paramPtr;    long     num;    Str31 *    mystr;
  323.  /* Convert a signed long integer to a Pascal string.  Instead of 
  324.     returning a new string, as Pascal does, it expects you to 
  325.     create mystr and pass it in to be filled. */
  326. {
  327.     paramPtr->inArgs[0] = num;
  328.     paramPtr->inArgs[1] = (long)mystr;
  329.     paramPtr->request = xreqNumToStr;
  330.     ((MyProcPtr) (paramPtr->entryPoint))();
  331. }
  332. /*    FUNCTION NumToStr(num: LongInt): Str31;
  333. VAR str: Str31;
  334. BEGIN
  335.   WITH paramPtr^ DO
  336.     BEGIN
  337.       inArgs[1] := num;
  338.       inArgs[2] := ORD(@str);
  339.       request := xreqNumToStr;
  340.       DoJsr(entryPoint);
  341.       NumToStr := str;
  342.     END;
  343. END;   */
  344.  
  345.  
  346. pascal void NumToHex(paramPtr,num,nDigits,mystr)
  347.     XCmdBlockPtr    paramPtr;    long     num;
  348.     short    nDigits;            Str31 *    mystr;
  349. /* Convert an unsigned long integer to a hexadecimal number and put it
  350.    into a Pascal string.  Instead of returning a new string, as 
  351.    Pascal does, it expects you to create mystr and pass it in to be filled. */
  352. {
  353.     paramPtr->inArgs[0] = num;
  354.     paramPtr->inArgs[1] = nDigits;
  355.     paramPtr->inArgs[2] = (long)mystr;
  356.     paramPtr->request = xreqNumToHex;
  357.     ((MyProcPtr) (paramPtr->entryPoint))();
  358. }
  359. /*    FUNCTION NumToHex(num: LongInt; nDigits: INTEGER): Str31;
  360. VAR str: Str31;
  361. BEGIN
  362.   WITH paramPtr^ DO
  363.     BEGIN
  364.       inArgs[1] := num;
  365.       inArgs[2] := nDigits;
  366.       inArgs[3] := ORD(@str);
  367.       request := xreqNumToHex;
  368.       DoJsr(entryPoint);
  369.       NumToHex := str;
  370.     END;
  371. END;   */
  372.  
  373.  
  374. pascal void BoolToStr(paramPtr,bool,mystr)
  375.     XCmdBlockPtr    paramPtr;    Boolean    bool;    Str31 *    mystr;
  376.  /* Convert a boolean to 'true' or 'false'.  Instead of returning 
  377.     a new string, as Pascal does, it expects you to create mystr
  378.     and pass it in to be filled. */
  379. {
  380.     paramPtr->inArgs[0] = (long)bool;
  381.     paramPtr->inArgs[1] = (long)mystr;
  382.     paramPtr->request = xreqBoolToStr;
  383.     ((MyProcPtr) (paramPtr->entryPoint))();
  384. }
  385. /*    FUNCTION BoolToStr(bool: BOOLEAN): Str31;
  386. VAR str: Str31;
  387. BEGIN
  388.   WITH paramPtr^ DO
  389.     BEGIN
  390.       inArgs[1] := LongInt(bool);
  391.       inArgs[2] := ORD(@str);
  392.       request := xreqBoolToStr;
  393.       DoJsr(entryPoint);
  394.       BoolToStr := str;
  395.     END;
  396. END;   */
  397.  
  398.  
  399. pascal void ExtToStr(paramPtr,myext,mystr)
  400.     XCmdBlockPtr    paramPtr;    extended *    myext;    Str31 *    mystr;
  401.  /* Convert an extended long integer to decimal digits in a string.  
  402.     Instead of returning a new string, as Pascal does, it expects 
  403.     you to create mystr and pass it in to be filled. */
  404. {
  405.     paramPtr->inArgs[0] = (long)myext;
  406.     paramPtr->inArgs[1] = (long)mystr;
  407.     paramPtr->request = xreqExtToStr;
  408.     ((MyProcPtr) (paramPtr->entryPoint))();
  409. }
  410. /*    FUNCTION ExtToStr(num: Extended): Str31;
  411. VAR str: Str31;
  412. BEGIN
  413.   WITH paramPtr^ DO
  414.     BEGIN
  415.       inArgs[1] := ORD(@num);
  416.       inArgs[2] := ORD(@str);
  417.       request := xreqExtToStr;
  418.       DoJsr(entryPoint);
  419.       ExtToStr := str;
  420.     END;
  421. END;   */
  422.  
  423.  
  424. pascal Handle GetGlobal(paramPtr,globName)
  425.     XCmdBlockPtr    paramPtr;    StringPtr    globName;
  426. /* Return a handle to a zero-terminated string containing the value of 
  427.    the specified HyperTalk global variable. */
  428. {
  429.     paramPtr->inArgs[0] = (long)globName;
  430.     paramPtr->request = xreqGetGlobal;
  431.     ((MyProcPtr) (paramPtr->entryPoint))();
  432.     return (Handle)paramPtr->outArgs[0];
  433. }
  434. /*    FUNCTION GetGlobal(globName: Str255): Handle;
  435. BEGIN
  436.   WITH paramPtr^ DO
  437.     BEGIN
  438.       inArgs[1] := ORD(@globName);
  439.       request := xreqGetGlobal;
  440.       DoJsr(entryPoint);
  441.       GetGlobal := Handle(outArgs[1]);
  442.     END;
  443. END;   */
  444.  
  445.  
  446. pascal void SetGlobal(paramPtr,globName,globValue)
  447.     XCmdBlockPtr    paramPtr;    StringPtr    globName;    Handle    globValue;
  448. /* Set the value of the specified HyperTalk global variable to be
  449.    the zero-terminated string in globValue.  The contents of the 
  450.    Handle are copied, so you must still dispose it afterwards.  */
  451. {
  452.     paramPtr->inArgs[0] = (long)globName;
  453.     paramPtr->inArgs[1] = (long)globValue;
  454.     paramPtr->request = xreqSetGlobal;
  455.     ((MyProcPtr) (paramPtr->entryPoint))();
  456. }
  457. /*    PROCEDURE SetGlobal(globName: Str255; globValue: Handle);
  458. BEGIN
  459.   WITH paramPtr^ DO
  460.     BEGIN
  461.       inArgs[1] := ORD(@globName);
  462.       inArgs[2] := ORD(globValue);
  463.       request := xreqSetGlobal;
  464.       DoJsr(entryPoint);
  465.     END;
  466. END;   */
  467.  
  468.  
  469. pascal Handle GetFieldByName(paramPtr,cardFieldFlag,fieldName)
  470.     XCmdBlockPtr    paramPtr;    Boolean    cardFieldFlag;
  471.     StringPtr    fieldName;
  472. /* Return a handle to a zero-terminated string containing the value of 
  473.    field fieldName on the current card.  You must dispose the handle. */
  474. {
  475.     paramPtr->inArgs[0] = (long)cardFieldFlag;
  476.     paramPtr->inArgs[1] = (long)fieldName;
  477.     paramPtr->request = xreqGetFieldByName;
  478.     ((MyProcPtr) (paramPtr->entryPoint))();
  479.     return (Handle)paramPtr->outArgs[0];
  480. }
  481. /*    FUNCTION GetFieldByName(cardFieldFlag: BOOLEAN; fieldName: Str255): Handle;
  482. BEGIN
  483.   WITH paramPtr^ DO
  484.     BEGIN
  485.       inArgs[1] := ORD(cardFieldFlag);
  486.       inArgs[2] := ORD(@fieldName);
  487.       request := xreqGetFieldByName;
  488.       DoJsr(entryPoint);
  489.       GetFieldByName := Handle(outArgs[1]);
  490.     END;
  491. END;   */
  492.  
  493.  
  494. pascal Handle GetFieldByNum(paramPtr,cardFieldFlag,fieldNum)
  495.     XCmdBlockPtr    paramPtr;    Boolean    cardFieldFlag;
  496.     short    fieldNum;
  497. /* Return a handle to a zero-terminated string containing the value of 
  498.    field fieldNum on the current card.  You must dispose the handle. */
  499. {
  500.     paramPtr->inArgs[0] = (long)cardFieldFlag;
  501.     paramPtr->inArgs[1] = fieldNum;
  502.     paramPtr->request = xreqGetFieldByNum;
  503.     ((MyProcPtr) (paramPtr->entryPoint))();
  504.     return (Handle)paramPtr->outArgs[0];
  505. }
  506. /*    FUNCTION GetFieldByNum(cardFieldFlag: BOOLEAN; fieldNum: INTEGER): Handle;
  507. BEGIN
  508.   WITH paramPtr^ DO
  509.     BEGIN
  510.       inArgs[1] := ORD(cardFieldFlag);
  511.       inArgs[2] := fieldNum;
  512.       request := xreqGetFieldByNum;
  513.       DoJsr(entryPoint);
  514.       GetFieldByNum := Handle(outArgs[1]);
  515.     END;
  516. END;   */
  517.  
  518.  
  519. pascal Handle GetFieldByID(paramPtr,cardFieldFlag,fieldID)
  520.     XCmdBlockPtr    paramPtr;    Boolean    cardFieldFlag;
  521.     short    fieldID;
  522. /* Return a handle to a zero-terminated string containing the value of 
  523.    the field whise ID is fieldID.  You must dispose the handle. */
  524. {
  525.     paramPtr->inArgs[0] = (long)cardFieldFlag;
  526.     paramPtr->inArgs[1] = fieldID;
  527.     paramPtr->request = xreqGetFieldByID;
  528.     ((MyProcPtr) (paramPtr->entryPoint))();
  529.     return (Handle)paramPtr->outArgs[0];
  530. }
  531. /*    FUNCTION GetFieldByID(cardFieldFlag: BOOLEAN; fieldID: INTEGER): Handle;
  532. BEGIN
  533.   WITH paramPtr^ DO
  534.     BEGIN
  535.       inArgs[1] := ORD(cardFieldFlag);
  536.       inArgs[2] := fieldID;
  537.       request := xreqGetFieldByID;
  538.       DoJsr(entryPoint);
  539.       GetFieldByID := Handle(outArgs[1]);
  540.     END;
  541. END;   */
  542.  
  543.  
  544. pascal void SetFieldByName(paramPtr,cardFieldFlag,fieldName,fieldVal)
  545.     XCmdBlockPtr    paramPtr;    Boolean    cardFieldFlag;
  546.     StringPtr    fieldName;    Handle    fieldVal;
  547. /* Set the value of field fieldName to be the zero-terminated string 
  548.    in fieldVal.  The contents of the Handle are copied, so you must 
  549.    still dispose it afterwards. */
  550. {
  551.     paramPtr->inArgs[0] = (long)cardFieldFlag;
  552.     paramPtr->inArgs[1] = (long)fieldName;
  553.     paramPtr->inArgs[2] = (long)fieldVal;
  554.     paramPtr->request = xreqSetFieldByName;
  555.     ((MyProcPtr) (paramPtr->entryPoint))();
  556. }
  557. /*    PROCEDURE SetFieldByName(cardFieldFlag: BOOLEAN; fieldName: Str255; fieldVal: Handle);
  558. BEGIN
  559.   WITH paramPtr^ DO
  560.     BEGIN
  561.       inArgs[1] := ORD(cardFieldFlag);
  562.       inArgs[2] := ORD(@fieldName);
  563.       inArgs[3] := ORD(fieldVal);
  564.       request := xreqSetFieldByName;
  565.       DoJsr(entryPoint);
  566.     END;
  567. END;   */
  568.  
  569.  
  570. pascal void SetFieldByNum(paramPtr,cardFieldFlag,fieldNum,fieldVal)
  571.     XCmdBlockPtr    paramPtr;    Boolean    cardFieldFlag;
  572.     short    fieldNum;            Handle    fieldVal;
  573. /* Set the value of field fieldNum to be the zero-terminated string 
  574.    in fieldVal.  The contents of the Handle are copied, so you must 
  575.    still dispose it afterwards. */
  576. {
  577.     paramPtr->inArgs[0] = (long)cardFieldFlag;
  578.     paramPtr->inArgs[1] = fieldNum;
  579.     paramPtr->inArgs[2] = (long)fieldVal;
  580.     paramPtr->request = xreqSetFieldByNum;
  581.     ((MyProcPtr) (paramPtr->entryPoint))();
  582. }
  583. /*    PROCEDURE SetFieldByNum(cardFieldFlag: BOOLEAN; fieldNum: INTEGER; fieldVal: Handle);
  584. BEGIN
  585.   WITH paramPtr^ DO
  586.     BEGIN
  587.       inArgs[1] := ORD(cardFieldFlag);
  588.       inArgs[2] := fieldNum;
  589.       inArgs[3] := ORD(fieldVal);
  590.       request := xreqSetFieldByNum;
  591.       DoJsr(entryPoint);
  592.     END;
  593. END;   */
  594.  
  595.  
  596. pascal void SetFieldByID(paramPtr,cardFieldFlag,fieldID,fieldVal)
  597.     XCmdBlockPtr    paramPtr;    Boolean    cardFieldFlag;
  598.     short    fieldID;            Handle    fieldVal;
  599. /* Set the value of the field whose ID is fieldID to be the zero-
  600.    terminated string in fieldVal.  The contents of the Handle are 
  601.    copied, so you must still dispose it afterwards. */
  602. {
  603.     paramPtr->inArgs[0] = (long)cardFieldFlag;
  604.     paramPtr->inArgs[1] = fieldID;
  605.     paramPtr->inArgs[2] = (long)fieldVal;
  606.     paramPtr->request = xreqSetFieldByID;
  607.     ((MyProcPtr) (paramPtr->entryPoint))();
  608. }
  609. /*    PROCEDURE SetFieldByID(cardFieldFlag: BOOLEAN; fieldID: INTEGER; fieldVal: Handle);
  610. BEGIN
  611.   WITH paramPtr^ DO
  612.     BEGIN
  613.       inArgs[1] := ORD(cardFieldFlag);
  614.       inArgs[2] := fieldID;
  615.       inArgs[3] := ORD(fieldVal);
  616.       request := xreqSetFieldByID;
  617.       DoJsr(entryPoint);
  618.     END;
  619. END;   */
  620.  
  621.  
  622. pascal Boolean StringEqual(paramPtr,str1,str2)
  623.     XCmdBlockPtr    paramPtr;    Str31 *     str1;    Str31 *     str2;
  624. /* Return true if the two strings have the same characters.  
  625.    Case insensitive compare of the strings. */
  626. {
  627.     paramPtr->inArgs[0] = (long)str1;
  628.     paramPtr->inArgs[1] = (long)str2;
  629.     paramPtr->request = xreqStringEqual;
  630.     ((MyProcPtr) (paramPtr->entryPoint))();
  631.     return (Boolean)paramPtr->outArgs[0];
  632. }
  633. /*    FUNCTION StringEqual(str1,str2: Str255): BOOLEAN;
  634. BEGIN
  635.   WITH paramPtr^ DO
  636.     BEGIN
  637.       inArgs[1] := ORD(@str1);
  638.       inArgs[2] := ORD(@str2);
  639.       request := xreqStringEqual;
  640.       DoJsr(entryPoint);
  641.       StringEqual := BOOLEAN(outArgs[1]);
  642.     END;
  643. END;   */
  644.  
  645.  
  646. pascal void ReturnToPas(paramPtr,zeroStr,pasStr)
  647.     XCmdBlockPtr    paramPtr;    Ptr    zeroStr;    StringPtr    pasStr;
  648. /* zeroStr points into a zero-terminated string.  Collect the 
  649.    characters from there to the next carriage Return and return 
  650.    them in the Pascal string pasStr.  If a Return is not found, 
  651.    collect chars until the end of the string. */
  652. {
  653.     paramPtr->inArgs[0] = (long)zeroStr;
  654.     paramPtr->inArgs[1] = (long)pasStr;
  655.     paramPtr->request = xreqReturnToPas;
  656.     ((MyProcPtr) (paramPtr->entryPoint))();
  657. }
  658. /*    PROCEDURE ReturnToPas(zeroStr: Ptr; VAR pasStr: Str255);
  659. BEGIN
  660.   WITH paramPtr^ DO
  661.     BEGIN
  662.       inArgs[1] := ORD(zeroStr);
  663.       inArgs[2] := ORD(@pasStr);
  664.       request := xreqReturnToPas;
  665.       DoJsr(entryPoint);
  666.     END;
  667. END;   */
  668.  
  669.  
  670. pascal void ScanToReturn(paramPtr,scanHndl)
  671.     XCmdBlockPtr    paramPtr;    Ptr *    scanHndl;
  672. /* Move the pointer scanPtr along a zero-terminated 
  673.    string until it points at a Return character
  674.    or a zero byte.  */
  675. {
  676.     paramPtr->inArgs[0] = (long)scanHndl;
  677.     paramPtr->request = xreqScanToReturn;
  678.     ((MyProcPtr) (paramPtr->entryPoint))();
  679. }
  680. /*    PROCEDURE ScanToReturn(VAR scanPtr: Ptr);
  681. BEGIN
  682.   WITH paramPtr^ DO
  683.     BEGIN
  684.       inArgs[1] := ORD(@scanPtr);
  685.       request := xreqScanToReturn;
  686.       DoJsr(entryPoint);
  687.     END;
  688. END;   */
  689.  
  690.  
  691. pascal void ScanToZero(paramPtr,scanHndl)
  692.     XCmdBlockPtr    paramPtr;    Ptr *    scanHndl;
  693. /* Move the pointer scanPtr along a zero-terminated 
  694.    string until it points at a zero byte.  */
  695. {
  696.     paramPtr->inArgs[0] = (long)scanHndl;
  697.     paramPtr->request = xreqScanToZero;
  698.     ((MyProcPtr) (paramPtr->entryPoint))();
  699. }
  700. /*    PROCEDURE ScanToZero(VAR scanPtr: Ptr);
  701. BEGIN
  702.   WITH paramPtr^ DO
  703.     BEGIN
  704.       inArgs[1] := ORD(@scanPtr);
  705.       request := xreqScanToZero;
  706.       DoJsr(entryPoint);
  707.     END;
  708. END;   */
  709.  
  710.  
  711.  
  712.  
  713.